#!/bin/bash

flist="wlist.txt"

floders=$(ls ${1}/)
for k in 20
do
    for floder in $floders 
    do
    files=$(ls ${1}/${floder}/)
        for file in $files 
        do
            input="${1}/${floder}/${file}"
	    echo ""	
	    time1=$(date)
	    echo ${time1}
	    echo "timeout 12000 ../../../KDefective -r ${input} -O solve -a MADEC -p -D Set -k ${k} -t 10800"
            bef=`grep "$file" $flist`
            if [ -z "$bef" ] 
            then 
                echo "Wrong before"
            else
	        timeout 12000 ../../../KDefective -r ${input} -O solve -a MADEC -p -D Set -k ${k} -t 10800
            fi
        done
    done
done
